//----------------------------------------------------------------------------
/** @file mcNode.h
 the node of the mc Tree */
//----------------------------------------------------------------------------
#ifndef MC_NODE
#define MC_NODE

#include <cstdlib>
#include<ctime>
#include "head.h"

using namespace std;

//typedef SgArrayList vector<mcNode> TreeNodeList;

class mcNode {
public:
	static int mcNode_num_static;

	int mcNode_num;
	static SgBlackWhite Color;

	int depth;

	mcNode* father;
	static SgVectorOf<mcNode> possible_next_moves;

	SgArrayList<Move, 20> moveList;

	Move curMove;

	SgVectorOf<mcNode> sons_of_this_node;

	int total_win_game;

	bool my_game_win;


	mcNode();
	~mcNode() {
	}
	mcNode(mcNode*,Move* move);
	//done
	void simulate(const RegionBoard&);
	//done
	void from_child(bool);
	//done

	void extends_this(Move*);

	SgArrayList<Move, 20> getMoveList();

	void print() {
		SG_ASSERT(this != father);
		SgDebug() << "print num " << mcNode_num << " depth " << depth << "\n";
		if(father != 0)
			SgDebug() << "father " << father->mcNode_num << "\n";
		SgDebug() << "movelist\n";
		for(SgArrayList<Move, 20>::Iterator mit(getMoveList()); mit; ++mit)
			SgDebug() << "move " << SgBW((*mit).Color()) << "  " << SgWritePoint((*mit).Point()) << "\n";
	}
};

#endif
